<template>
  <div class="dashboard-container">
    <div class="dashboard-text">name: {{name}}</div>
    <div class="dashboard-text">role: {{role}}</div>
    <!--<el-button plain @change="">右上角</el-button>-->
  </div>

</template>

<script>
import { mapGetters } from 'vuex'
import { getTimeByOrderRecord } from '../../api/music'

export default {
  name: 'dashboard',
  data() {
    return {
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'roles'
    ])
  },
  mounted() {
    this.$nextTick(() => {
      this.playMessage()
    })
  },
  methods: {
    playMessage() {
      window.setInterval(() => {
        this.openMessage()
      }, 1000 * 60)
    },
    openMessage() {
      getTimeByOrderRecord().then(res => {
        if (res.data.length > 0) {
          this.$notify({
            title: '您有新的预定订单需要审核处理！',
            message: '',
            position: 'bottom-left'
          })
        }
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
